package com.iplant.ams.service.po.dms.scada.conf;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.po.DBBasePO;

import java.io.Serializable;

@DBBasePO(TableName = "dms_device_server", Schemas = DBSchemas.AMS, CheckName = {"Code", "ServerType,ServerName"}, CodeAuto = true,
        CodePrefix = "DMS-Server-", CodeNum = 4)
public class DMSDeviceServer extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;

    @DBCondition(CompareType = DBCondition.DBCompareType.like,ParamName2 = "NameEQ")
    @DBField(name = "ServerName", CheckValue = true)
    public String Name = "";
    @DBCondition
    @DBField(CheckValue = true)
    public int ServerType = 0;
    @DBField
    public String ClientName = "";

    @DBField
    public String ServerUrl = "";

    @DBField
    public boolean Configured = false;

    @DBField
    public boolean IsFilePath = false;
    @DBField
    public String ConfigurationSectionName = "Opc.Ua.SampleClient";


    /**
     * 是否匿名连接
     */
    @DBField
    public boolean IsAnonymous = false;

    /**
     * 用户名
     */
    @DBField
    public String UserName = "";

    /**
     * 密码
     */
    @DBField
    public String Password = "";

    /**
     * 数据安全策略
     * 0= select best endpointUrl
     * 1="http://opcfoundation.org/UA/SecurityPolicy#None"
     * 2="http://opcfoundation.org/UA/SecurityPolicy#Basic128Rsa15"
     * 3="http://opcfoundation.org/UA/SecurityPolicy#Basic256"
     * 4="http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256"
     */
    @DBField
    public int SecerityPolic = 1;

    /**
     * 忽略服务器 server nonce 验证，828D 无法连接时，建议置 TRUE
     */
    @DBField
    public boolean IgnoreVaildServerNonce = true;


    @Override
    public String getName() {
        return Name;
    }

    @Override
    public void setName(String name) {
        Name = name;
    }

    public int getServerType() {
        return ServerType;
    }

    public void setServerType(int serverType) {
        ServerType = serverType;
    }

    public String getClientName() {
        return ClientName;
    }

    public void setClientName(String clientName) {
        ClientName = clientName;
    }

    public String getServerUrl() {
        return ServerUrl;
    }

    public void setServerUrl(String serverUrl) {
        ServerUrl = serverUrl;
    }

    public boolean isConfigured() {
        return Configured;
    }

    public void setConfigured(boolean configured) {
        Configured = configured;
    }

    public boolean isFilePath() {
        return IsFilePath;
    }

    public void setFilePath(boolean filePath) {
        IsFilePath = filePath;
    }

    public String getConfigurationSectionName() {
        return ConfigurationSectionName;
    }

    public void setConfigurationSectionName(String configurationSectionName) {
        ConfigurationSectionName = configurationSectionName;
    }

    public boolean isAnonymous() {
        return IsAnonymous;
    }

    public void setAnonymous(boolean anonymous) {
        IsAnonymous = anonymous;
    }

    public String getUserName() {
        return UserName;
    }

    public void setUserName(String userName) {
        UserName = userName;
    }

    public String getPassword() {
        return Password;
    }

    public void setPassword(String password) {
        Password = password;
    }

    public int getSecerityPolic() {
        return SecerityPolic;
    }

    public void setSecerityPolic(int secerityPolic) {
        SecerityPolic = secerityPolic;
    }

    public boolean isIgnoreVaildServerNonce() {
        return IgnoreVaildServerNonce;
    }

    public void setIgnoreVaildServerNonce(boolean ignoreVaildServerNonce) {
        IgnoreVaildServerNonce = ignoreVaildServerNonce;
    }
}
